Repository navigation
Fix orphaned extension reconnect seed tab - #133
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthrough
ChangesExtension tab cleanup
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant CDPRelayServer
participant ExtensionProtocolV2
participant BrowserModel
participant ChromeTabs
CDPRelayServer->>ExtensionProtocolV2: Pass cached connect-page prefix
ExtensionProtocolV2->>BrowserModel: Initialize with prefix
BrowserModel->>BrowserModel: Create target and inspect known matching tabs
BrowserModel->>ChromeTabs: Remove matching stale seed tab
Possibly related PRs
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/extension/browserModel.ts`:
- Around line 119-123: Update the orphaned-tab cleanup in the target creation
flow to use Promise.allSettled instead of Promise.all, while preserving the
existing filtering and _sendToExtension calls. Cleanup rejections must be
tolerated so createTarget still returns the newly created target result.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 756bf674-9c34-46e9-80a8-019f15f64440
📒 Files selected for processing (2)
src/extension/browserModel.tstests/extension-protocol.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8bf74a8a16
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 31e38ad635
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Summary
connect.html?mcpRelayUrl=seed tab after its replacement target is attachedUpstream context
Upstream issue: microsoft/playwright#41864
Playwright reports that after an extension reconnect, making
browser_tabs { action: "new" }the first tool call creates a second target and leaves the connection seed page orphaned. This repository has the same protocol-v2 flow: token bypass adopts the seed page, thenBrowserModel.createTarget()attached the requested page without retiring the infrastructure tab.The fix removes only other known tabs with the exact extension seed URL, and only after the replacement target attaches. This resolves the locally reproducible cause without changing general tab behavior or attempting to patch the separate competing-tab-group race owned by the browser extension.
Closes #132
Validation
mainnpm test -- tests/extension-protocol.test.tsnpm run lintnpm test(34 files, 368 tests)npm run buildgit diff --checkSummary by CodeRabbit
Bug Fixes
Tests